package com.rd.student.dashuju.zhengchengxiang.day0808;


import java.io.BufferedReader;
import java.io.FileReader;
import java.util.HashMap;
import java.util.Scanner;

public class TeamTest {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new FileReader("player.txt"));
        // 存储球员信息
        HashMap<String, String> player = new HashMap<>();
        String team = null;
        while (true) {
            team = br.readLine();
            if (team == null) break;
            String[] split = team.split("，");
            player.put(split[0], split[1]);

        }
        br.close();

        // 打印球员信息
        Scanner sc = new Scanner(System.in);
        while (true) {
            System.out.println("请输入球员名：");
            String name = sc.nextLine();
            if (player.containsKey(name)) {
                System.out.println(name + "所属" + player.get(name));
            } else {
                System.out.println("不存在该球员");
                break;
            }
        }
    }
}
